home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 June / macformat-038.iso / Demos / Interactive Wave / _DATAS / SHARED.Dxr / 00983_Gestion des RollOvers I.ls < prev    next >
Encoding:
Text File  |  1995-08-06  |  5.6 KB  |  188 lines

  1. on SetDcRollOver
  2.   global listRollGen
  3.   if (listRollGen = list()) or voidp(listRollGen) then
  4.     set listRollGen to list()
  5.     exit
  6.   end if
  7.   UnPuppetSprRoll()
  8.   set listRollGen to list()
  9. end
  10.  
  11. on UnPuppetSprRoll
  12.   global listRollGen
  13.   set Piste to 2
  14.   repeat with AccuA = 1 to getAt(listRollGen, 1)
  15.     FalsePisteTest(getAt(listRollGen, Piste))
  16.     set Piste to Piste + 4
  17.   end repeat
  18. end
  19.  
  20. on InitRollGen Champs, operande
  21.   global listRollGen
  22.   if (paramCount() <> 2) or (listRollGen = list()) then
  23.     set listRollGen to list(0)
  24.   end if
  25.   set Pz to 1
  26.   set AccuLen to the number of words in Champs / 4
  27.   repeat with AccuB = 1 to AccuLen
  28.     add(listRollGen, value(word Pz of Champs))
  29.     add(listRollGen, the number of cast word Pz + 1 of Champs)
  30.     add(listRollGen, the number of cast word Pz + 2 of Champs)
  31.     add(listRollGen, the number of cast word Pz + 3 of Champs)
  32.     set Pz to Pz + 4
  33.   end repeat
  34.   setAt(listRollGen, 1, (count(listRollGen) - 1) / 4)
  35.   PuppetSprRoll(listRollGen)
  36.   BalayRollGen()
  37. end
  38.  
  39. on AjouteRollGen Champs, operande
  40.   InitRollGen(Champs, 1)
  41. end
  42.  
  43. on PuppetSprRoll
  44.   global listRollGen
  45.   set Piste to 2
  46.   repeat with AccuA = 1 to getAt(listRollGen, 1)
  47.     puppetSprite(getAt(listRollGen, Piste), 1)
  48.     set Piste to Piste + 4
  49.   end repeat
  50. end
  51.  
  52. on BalayRollGen
  53.   global listRollGen, DcCursMain
  54.   if listRollGen = [] then
  55.     exit
  56.   end if
  57.   set Pz to 2
  58.   repeat with Compteur = 1 to getAt(listRollGen, 1)
  59.     set NumSpr to getAt(listRollGen, Pz)
  60.     if rollOver(NumSpr) then
  61.       set the castNum of sprite NumSpr to getAt(listRollGen, Pz + 2)
  62.       SetAffTxtRoll(getAt(listRollGen, Pz + 3))
  63.       set DcCursMain to 1
  64.     else
  65.       set the castNum of sprite NumSpr to getAt(listRollGen, Pz + 1)
  66.     end if
  67.     set Pz to Pz + 4
  68.   end repeat
  69. end
  70.  
  71. on SetDcRollTexte
  72.   global listRollTexte
  73.   set listRollTexte to list()
  74. end
  75.  
  76. on InitRollTexte Champs, operande
  77.   global listRollTexte
  78.   if (paramCount() <> 2) or (listRollTexte = list()) then
  79.     set listRollTexte to list(0)
  80.   end if
  81.   set Pz to 1
  82.   set AccuLen to the number of words in Champs / 2
  83.   repeat with AccuB = 1 to AccuLen
  84.     add(listRollTexte, value(word Pz of Champs))
  85.     add(listRollTexte, the number of cast word Pz + 1 of Champs)
  86.     set Pz to Pz + 2
  87.   end repeat
  88.   setAt(listRollTexte, 1, (count(listRollTexte) - 1) / 2)
  89.   BalayRollTexte()
  90. end
  91.  
  92. on AjouteRollTexte Champs, operande
  93.   InitRollTexte(Champs, 1)
  94. end
  95.  
  96. on BalayRollTexte
  97.   global listRollTexte, DcCursMain
  98.   if listRollTexte = [] then
  99.     exit
  100.   end if
  101.   set Pz to 2
  102.   repeat with Compteur = 1 to getAt(listRollTexte, 1)
  103.     if rollOver(getAt(listRollTexte, Pz)) then
  104.       SetAffTxtRoll(getAt(listRollTexte, Pz + 1))
  105.       set DcCursMain to 1
  106.     end if
  107.     set Pz to Pz + 2
  108.   end repeat
  109. end
  110.  
  111. on SetDcRollCadre
  112.   global listRollCadre
  113.   if (listRollCadre = list()) or voidp(listRollCadre) then
  114.     set listRollCadre to list()
  115.     exit
  116.   end if
  117.   FalsePisteTest(getAt(listRollCadre, 1))
  118.   set listRollCadre to list()
  119. end
  120.  
  121. on InitRollCadre SprRoll, NomCadre, NbrCol, NbrLig, Xcoeff, Ycoeff, XcolFixe, YligFixe, Champs
  122.   global listRollCadre
  123.   set listRollCadre to list(SprRoll, 0, 0, 0, 0, 0, NbrCol, NbrLig, Xcoeff, Ycoeff, XcolFixe - 1, YligFixe - 1, 1, 1)
  124.   setAt(listRollCadre, 2, the number of cast NomCadre)
  125.   setAt(listRollCadre, 3, the left of sprite SprRoll)
  126.   setAt(listRollCadre, 4, the top of sprite SprRoll)
  127.   setAt(listRollCadre, 5, getAt(listRollCadre, 3) + (NbrCol * Xcoeff))
  128.   setAt(listRollCadre, 6, getAt(listRollCadre, 4) + (NbrLig * Ycoeff))
  129.   set Pz to 1
  130.   repeat with Compteur = 1 to the number of words in Champs / 2
  131.     add(listRollCadre, word Pz of Champs)
  132.     add(listRollCadre, the number of cast word Pz + 1 of Champs)
  133.     set Pz to Pz + 2
  134.   end repeat
  135.   puppetSprite(SprRoll, 1)
  136.   BalayRollCadre()
  137. end
  138.  
  139. on ClicCadreRoll
  140.   global listRollCadre, DcDemoRec
  141.   if listRollCadre = [] then
  142.     exit
  143.   end if
  144.   set NomMacro to getAt(listRollCadre, (((getAt(listRollCadre, 14) * getAt(listRollCadre, 7)) + getAt(listRollCadre, 13)) * 2) + 15)
  145.   if DcDemoRec then
  146.     CorParaDemRec(NomMacro)
  147.   end if
  148.   do(NomMacro)
  149. end
  150.  
  151. on BalayRollCadre
  152.   global listRollCadre, DcCursMain, CastEfface
  153.   if listRollCadre = [] then
  154.     exit
  155.   end if
  156.   set SprRoll to getAt(listRollCadre, 1)
  157.   set AccuX to the mouseH
  158.   if AccuX > getAt(listRollCadre, 3) then
  159.     if AccuX < getAt(listRollCadre, 5) then
  160.       set AccuY to the mouseV
  161.       if AccuY > getAt(listRollCadre, 4) then
  162.         if AccuY < getAt(listRollCadre, 6) then
  163.           set AccuX to (AccuX - getAt(listRollCadre, 3)) / getAt(listRollCadre, 9)
  164.           set AccuY to (AccuY - getAt(listRollCadre, 4)) / getAt(listRollCadre, 10)
  165.           set IndexPara to (((AccuY * getAt(listRollCadre, 7)) + AccuX) * 2) + 15
  166.           if getAt(listRollCadre, IndexPara) <> "Nothing" then
  167.             set the castNum of sprite SprRoll to getAt(listRollCadre, 2)
  168.             set the locH of sprite SprRoll to (AccuX * getAt(listRollCadre, 9)) + getAt(listRollCadre, 3)
  169.             set the locV of sprite SprRoll to (AccuY * getAt(listRollCadre, 10)) + getAt(listRollCadre, 4)
  170.             SetAffTxtRoll(getAt(listRollCadre, IndexPara + 1))
  171.             setAt(listRollCadre, 13, AccuX)
  172.             setAt(listRollCadre, 14, AccuY)
  173.             set DcCursMain to 1
  174.             exit
  175.           end if
  176.         end if
  177.       end if
  178.     end if
  179.   end if
  180.   if getAt(listRollCadre, 11) <> -1 then
  181.     set the castNum of sprite SprRoll to getAt(listRollCadre, 2)
  182.     set the locH of sprite SprRoll to (getAt(listRollCadre, 11) * getAt(listRollCadre, 9)) + getAt(listRollCadre, 3)
  183.     set the locV of sprite SprRoll to (getAt(listRollCadre, 12) * getAt(listRollCadre, 10)) + getAt(listRollCadre, 4)
  184.   else
  185.     set the castNum of sprite SprRoll to CastEfface
  186.   end if
  187. end
  188.